<!-- 会员中心主内容区 -->
<div class="page-article">
  <!-- 我的评论 -->
  <div class="member_welhead"><ins></ins><b><{t}>Возвраты и замены<{/t}></b> </div>
  <div id="member_aftersales" class="member-aftersales">
    <div class="member-tabs">
      <a href="<{link app=aftersales ctl=site_member act=afterlist}>" class="active"><em><{t}>申请退换货<{/t}></em></a>
      <a href="<{link app=aftersales ctl=site_member act=afterrec}>"><em><{t}>退换货记录<{/t}></em></a>
    </div>
    <div class="member-mod">
      <iframe src="about:blank" name="upload" frameborder="0" class="hide"></iframe>
      <form action="<{link app=aftersales ctl=site_member act=return_save}>" method="post" enctype="multipart/form-data" encoding="multipart/form-data" target="upload">
        <input type="hidden" name="order_id" value="<{$order_id}>">
        <h3><span class="label-warning">1</span><{t}>请选择需要退换货的商品以及数量<{/t}></h3>
        <div id="member_aftersales_goods" class="member-aftersales-goods table-responsive">
          <table class="member-grid table table-hover table-striped table-bordered">
            <thead>
              <tr>
                <th><{t}>申请<{/t}></th>
                <th><{t}>数量<{/t}></th>
                <th><{t}>货号<{/t}></th>
                <th><{t}>商品名称<{/t}></th>
                <th><{t}>单价<{/t}></th>
              </tr>
            </thead>
            <tbody class="first">
	            <{foreach from=$order.items item=item key=key name=name}>
				<{if $item.quantity>0}>
				  <tr class="<{if $smarty.foreach.name.iteration == 1}>first<{/if}>">
					<td class="actions">
					<div class="checkbox">
					<label for="">
					  <input type="checkbox" name="product_bn[<{$item.products.product_id}>]" value='<{$item.bn}>' id="" class="x-check" vtype="requiredcustom" data-validatormsg="<{t}>请先选择要退换的商品<{/t}>">
					  <{t}>退换<{/t}></label>
					 </div> 
					</td>
					<td class="numbers">
					  <{input type="select" name="product_nums[{$item.products.product_id}]" options=$item.arrNum class="x-select input-sm" required=true value=$item.quantity}>
					</td>
					<td class="itemno"><{$item.bn}></td>
					<input type="hidden" name="product_name[<{$item.products.product_id}>]" value=<{$item.name}> >
					<td class="goods-name"><a href="<{$item.link_url}>"><img width="30px;" style="vertical-align:middle;" src="<{$item.thumbnail_pic|default:$env.conf.site.default_thumbnail_pic|storager:'s'}>" title="<{$item.name}>&nbsp;<{$item.attr}>" alt="<{$item.name}>&nbsp;<{$item.attr}>"></a><{$item.name}></td>
					<input type="hidden" name="product_price[<{$item.products.product_id}>]" value=<{$item.price}> >
					<td class="price"><{$item.price|cur_odr:$order.currency}></td>
				  </tr>
				<{/if}>
              <{/foreach}>
            </tbody>
          </table>
        </div>

        <h3><span class="label-warning">2</span><{t}>填写退换理由，如有必要也可附图说明<{/t}></h3>

  
            <label for=""><em class="warn">*</em><{t}>类型：<{/t}></label>
			<div class="radio-inline">
			  <label for="return">
              <input type="radio" name="type" value="1" id="return" vtype="required" data-caution="<{t}>请填写退换理由<{/t}>" checked="checked"><{t}>退货<{/t}></label>
			</div>
			<div class="radio-inline">
			  <label for="exchange">
              <input type="radio" name="type" value="2" id="exchange" vtype="required" data-caution="<{t}>请填写换货理由<{/t}>"><{t}>换货<{/t}></label>
			</div>
			<div class="clearfix"></div>

			<div class="form-group">
            <label for="" ><em class="warn">*</em><{t}>退换理由：<{/t}></label>
              <input type="text" name="title" id="" class="x-input form-control" placeholder="<{t}>简单描述退换理由<{/t}>" vtype="required" data-caution="<{t}>请填写退换理由<{/t}>">
			</div>
			<div class="form-group">
            <label for=""><{t}>详细描述<{/t}>：</label>
              <textarea name="content" id="" class="x-input form-control" cols="50" rows="5" placeholder="<{t}>请描述遇到的问题以及详细的退换理由，不超过1000字<{/t}>"></textarea>
			</div>
			<div class="form-group">
            <label for=""><{t}>上传图片<{/t}>：</label>
              <input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
              <input type="file" name="file" id="" accept="image/gif,image/jpg,image/jpeg,image/png">
               <p class="help-block"><{t}> 图片大小不超过2M，格式为jpg,gif,jpeg,png<{/t}></p>
      		</div>
			

			<div class="checkbox">
			  <label for="">	
              <input type="checkbox" checked="checked" name="agree" id="" class="x-check" vtype="onerequired" data-caution="请先选择同意">
              <{t}>同意<{/t}> <a href="javascript:openWindow('<{link app=aftersales ctl=site_member act=read}>', {width:800, height:0.8,position:'center'});"><{t}>售后服务须知<{/t}></a></label>
    		</div>
			<div class="form-group">
              <{button type="submit" class="btn btn-primary pull-right" label="提交申请"}>
              <a href="<{link app=aftersales ctl=site_member act=afterlist}>" class="btn btn-default pull-right"><span><span><{t}>取消申请<{/t}></span></span></a>
			  <div class="clearfix"></div>
			</div>

      </form>
    </div>
  </div>
</div>
<script>
Object.merge(validatorMap, {
    requiredcustom: function(element, v, type, parent){
        var name = element.name;
        if(!parent.getElement('.member-grid').getElements('input[type=' + type + ']').some(function(el) {
            element.bindEvent = false;
            return el.checked;
        })) {
            return Message.error(element.get('data-validatormsg'));
        }
        return true;
    }
});
var submit = $('member_aftersales').getElement('button[type=submit]');

function ajax_callback(type, msg, url) {
    if(type == 'error') {
        submit.removeClass('disabled');
    }
    return top.Message( msg, type, function(){
        if(url) location.href = url;
    });
}
$('member_aftersales_goods').getElements('input[type=checkbox]').addEvent('click', function(){
    this.getParent('tr')[this.checked ? 'addClass' : 'removeClass']('selected');
});
</script>

